package stud.mpgame.server.map;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import com.google.gson.Gson;

public class MapDeserializer {
	public static MapData deserialize(String urlString) throws IOException {
		URL url = new URL(urlString);
		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
	    connection.connect();
	    Gson gson = new Gson();
	    return gson.fromJson(new BufferedReader(new InputStreamReader(connection.getInputStream())), MapData.class);
	}
}
